package com.svo.weitu.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;

import com.svo.weitu.R;
import com.svo.weitu.model.push.MPush;

import java.util.Timer;
import java.util.TimerTask;

import cn.jpush.android.api.JPushInterface;

public class Welcome extends Activity {
	private SharedPreferences preferences;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.welcome);
		//推送开关
		SharedPreferences settingSP= PreferenceManager.getDefaultSharedPreferences(this);
		if (settingSP.getBoolean("push_on_off", true)) {
			JPushInterface.setDebugMode(false); // 设置开启日志,发布时请关闭日志
			JPushInterface.init(getApplicationContext()); // 初始化 JPush
			new MPush(getApplicationContext()).init();
		}
		preferences = getSharedPreferences("weitu", Context.MODE_PRIVATE);
		new Timer().schedule(new TimerTask() {
			@Override
			public void run() {
				/*if (preferences.getBoolean("isFirst", true)) {
					preferences.edit().putBoolean("isFirst", false).commit();
					startActivity(new Intent(Welcome.this, UserGuide.class));
				}else {
				}*/
				startActivity(new Intent(Welcome.this, MainActivity.class));
				overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
				finish();
			}
		}, 2000);
	}
}
